package com.sfx.concurrent.demo.concurrent.Singleton;

/**
 * 饿汉式单例 -> 枚举类版本
 */
public enum Singleton2 {
    INSTANCE;

    Singleton2() {
        System.out.println("Singleton2()");
    }

    public static Singleton2 getINSTANCE() {
        return INSTANCE;
    }

    public static void otherMethod() {
        System.out.println("otherMethod()");
    }

    @Override
    public String toString() {
        return Integer.toHexString(hashCode());
    }
}